<?php

namespace Core\Result;
/**
 * 通用回调函数
 * */
class Result
{
    public static function success($data=null){
        exit(json_encode(array(
            "code"=>200,
            "msg"=>"成功",
            "data"=>$data ?:null
        ),JSON_UNESCAPED_UNICODE));
    }
    public static function error($msg,$code=500){
        exit(json_encode(array(
            "code"=>$code,
            "msg"=>$msg,
            "data"=>null
        ),JSON_UNESCAPED_UNICODE));
    }
}